const {
    LinValidator,
    Rule
} = require('../../core/lin-validator-v2')

const {
    optionsIdValidator,
    PaginateValidator
} = require('./common')

class addFundValidator extends LinValidator { //新增
    constructor() {
        super()
        this.incomeName = [
            new Rule('isLength', '必传', {
                min: 1,
                max: 32
            }),
        ]
        this.buyPrice = [
            new Rule('isInt', '需要传入整数'),
        ]
    }

}

class editFundValidator extends LinValidator { //修改
    constructor() {
        super()
        this.id = new Rule('isLength', '必传', {
            min: 1,
            max: 32
        })

        this.incomeName = [
            new Rule('isOptional', '', ''),
            new Rule('isLength', '必传', {
                min: 1,
                max: 32
            }),
        ]
        this.buyPrice = [
            new Rule('isOptional', '', ''),
            new Rule('isInt', '需要传入整数'),
        ]
        this.dropPrice = [
            new Rule('isOptional', '', ''),
            new Rule('isInt', '需要传入整数'),
        ]
    }

}
class listFundValidator extends PaginateValidator { //列表
    constructor() {
        super()
        this.p = [
            new Rule('isOptional', '', ''),
            new Rule('isLength', '必传', {
                min: 1,
                max: 32
            }),
        ]
    }

}
module.exports = {
    addFundValidator,
    listFundValidator,
    editFundValidator
}